#pragma once

#include "City.h"

class node
{
	friend class list;
	friend class Queue;
private:
	City data;
	node *next;
public:
	node(){};
	node(City d,node *c){

		data._index =d._index;
		data._name=d._name;
		data._marked=d._marked;

		next=c;
	}
};

class list
{
private: node *chain;
		 node *tail;
public: list(){chain = nullptr; }

		void add_athead(City d)
		{
			node *temp1=new node;
			temp1->data=d;
			temp1->next=chain;
			chain=temp1;
		}

		node* getHead(){
			return chain;
		}

		node* getTail(){
			return tail;
		}
		
		void removeHead(){
			if(chain==nullptr)
				return;
			if(chain->next==nullptr){
				tail=chain->next;
			}
			chain=chain->next;
		}

	void insertTail(City d)
	{
		node* temp=new node();
		temp->data=d;
		temp->next=nullptr;
		if(chain ==nullptr)
		{
			chain =temp;
			tail=temp;
			return;
		}
		tail->next=temp;
		tail=temp;
	}
	
	int size()
	{
		
		int size=0;
		node *p=chain;
		while(p!=nullptr){
			size ++;
			p=p->next;
		}
		return size;
	}

bool isEmpty(){
	if(chain ==nullptr)
		return true;
	return false;
}

};